<?php
/**
 * Created by PhpStorm.
 * User: 牛赞赞
 * Date: 2021/4/21
 * Time: 18:30
 */

namespace App\Model;


class GrandMatchRecord extends Model
{
    protected $table = 'mj_grand_match_record';
    protected $fillable = ['uid', 'round', 'win_lose', 'cpns_id', 'challenge_times', 'status', 'start_time'];
    public $timestamps = false;

    // 插入大奖赛对局记录
    public static function insertRecord($data)
    {
        try {
            self::query()->insert($data);
            return ['code' => 0, 'msg' => 'OK'];
        } catch (\Exception $e) {
            return ['code' => 1, 'msg' => $e->getMessage()];
        }
    }

    public static function getRecordsNum($where)
    {
        try {
            $num = self::query()->where($where)->count('id');
            return ['code' => 0, 'data' => $num];
        } catch (\Exception $e) {
            return ['code' => 1, 'msg' => $e->getMessage()];
        }
    }
}